package com.finddeer.bookkeeping.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import com.finddeer.bookkeeping.fragment.BookkeepingFragment;
import com.finddeer.bookkeeping.fragment.BudgetFragment;
import com.finddeer.bookkeeping.fragment.StatisticsFragment;
import com.finddeer.bookkeeping.fragment.TendencyFragment;

/**
 * author    : leaves
 * gitee     : https://gitee.com/LEAVES2018
 * time      : 2018/12/24 10:04 PM
 * function  : 主界面底部菜单适配器
 */
public class MainFragmentAdapter extends FragmentStatePagerAdapter {
    public MainFragmentAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int i) {
        Fragment fragment = null;
        switch (i) {
            case 0:
                fragment = new BookkeepingFragment();
                break;
            case 1:
                fragment = new StatisticsFragment();
                break;
            case 2:
                fragment = new TendencyFragment();
                break;
            case 3:
                fragment = new BudgetFragment();
                break;
            default:
                break;
        }
        return fragment;
    }

    @Override
    public int getCount() {
        return 4;
    }

}
